package svc

import (
	"github.com/zeromicro/go-zero/rest"
	"github.com/zeromicro/go-zero/zrpc"
	"muke/api/internal/config"
	"muke/api/internal/middleware"
	"muke/mukerpc/mukerpcclient"
)

type ServiceContext struct {
	Config              config.Config
	MukeRpc             mukerpcclient.Mukerpc
	UserValidMiddleware rest.Middleware
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:              c,
		MukeRpc:             mukerpcclient.NewMukerpc(zrpc.MustNewClient(c.MukeRpc)),
		UserValidMiddleware: middleware.NewUserValidMiddleware().Handle,
	}
}
